Telegram Group & Telegram Channel
Что выведет этот код на Python?


x = [1, 2, 3]
y = x
x += [4]

print(x)
print(y)


🔢 Варианты ответа:

A)

[1, 2, 3]


B)

[1, 2, 3, 4]


C)

[1, 2, 3, 4]


D)

[1, 2, 3]


Правильный ответ: B

💡 Почему?
-
x = [1, 2, 3] и y = x — ссылка на один и тот же список.
-
x += [4] модифицирует список на месте.
- Поэтому
y тоже видит изменение.
🧠 Подвох — в
+=, который работает не как x = x + [...].



tg-me.com/python_job_interview/1072
Create:
Last Update:

Что выведет этот код на Python?


x = [1, 2, 3]
y = x
x += [4]

print(x)
print(y)


🔢 Варианты ответа:

A)

[1, 2, 3]


B)

[1, 2, 3, 4]


C)

[1, 2, 3, 4]


D)

[1, 2, 3]


Правильный ответ: B

💡 Почему?
-
x = [1, 2, 3] и y = x — ссылка на один и тот же список.
-
x += [4] модифицирует список на месте.
- Поэтому
y тоже видит изменение.
🧠 Подвох — в
+=, который работает не как x = x + [...].

BY Python вопросы с собеседований


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/python_job_interview/1072

View MORE
Open in Telegram


Python вопросы с собеседований Telegram | DID YOU KNOW?

Date: |

Find Channels On Telegram?

Telegram is an aspiring new messaging app that’s taking the world by storm. The app is free, fast, and claims to be one of the safest messengers around. It allows people to connect easily, without any boundaries.You can use channels on Telegram, which are similar to Facebook pages. If you’re wondering how to find channels on Telegram, you’re in the right place. Keep reading and you’ll find out how. Also, you’ll learn more about channels, creating channels yourself, and the difference between private and public Telegram channels.

Importantly, that investor viewpoint is not new. It cycles in when conditions are right (and vice versa). It also brings the ineffective warnings of an overpriced market with it.Looking toward a good 2022 stock market, there is no apparent reason to expect these issues to change.

Python вопросы с собеседований from es


Telegram Python вопросы с собеседований
FROM USA